<template>
  <Card class="role_account_lock">
  <div>
      <Row>
        <label>url:</label>
        <input v-model="url" placeholder="url" ></input>
        <label>桌子密码:</label>
        <input v-model="tablePWD" placeholder="桌子密码" ></input>
        <Button type="primary" @click="onLock">发送</Button>
      </Row>
  </div>
  </Card>
</template>
<script>
import {sendTablePWD} from '@/api/game.js'
export default {
  data () {
    return {
      tablePWD: '1',
      url: 'http://116.62.239.190:50005'
    }
  },
  created () {
    // console.log('created')
  },
  methods: {
    onLock () {
      if (this.url === '') {
        this.$Message.error('url不能全都为空!!!')
        return
      }
      if (this.tablePWD === '') {
        this.$Message.error('桌子密码不能全都为空!!!')
        return
      }
      sendTablePWD(this.url, this.tablePWD).then((data) => {
        if (!data) {
          return
        }
        let ret = data.data.data.intValues[0]
        console.log('onLock ret:', ret)
        if (ret === 0) {
          this.$Message.info('发送成功!!!')
        } else {
          let msg = '发送失败,errorCode:' + ret
          this.$Message.error(msg)
        }
      })
    }
  },
  computed: {
    // console.log('computed')
  }
}
</script>
<style scoped>
  .role_account_lock {
    width: 500px;
    margin: 60px auto;
  }
</style>
